import request from '@/utils/request'

export const getEmployeesPage = (pageSize = 1, limit = 8) => {
  return request.get('/employees/page', {
    params: {
      pageSize,
      limit
    }
  })
}

export const getEmployeesAll = () => {
  return request.get('/employees/all')
}

export const getEmployeesByTelephone = (telephone) => {
  return request.get(`/employees/tel/${telephone}`)
}

export const getEmployeesIsLogin = () => {
  return request.get('/employees/is-login')
}

export const getEmployeesCheckLogin = () => {
  return request.get('/employees/check-login')
}

export const deleteEmployee = (telephone) => {
  return request.delete(`/employees/delete/${telephone}`)
}

export const updateEmployee = (employee) => {
  return request.patch('/employees/update-info/', employee)
}

export const createEmployee = (employee) => {
  return request.post('/employees/create', employee)
}

export const updateEmployeeState = (telephone, state) => {
  return request.patch('/employees/update-info/', {
    params: {
      telephone,
      state
    }
  })
}

export const updateEmployeePassword = (updatePasswordVo) => {
  return request.patch('/employees/update-password', updatePasswordVo)
}

export const forgetEmployeePassword = (email, Vcode) => {
  return request.patch(`/employees/forger-password/verification/${email}/${Vcode}`)
}

export const getMeInfo = () => {
  return request.post('/employees/me')
}

export const updateAvatar = () => {
  return request.post('/employees/upload')
}

export const login = (Vcode, loginVo) => {
  return request.post(`/employees/verification/login/${Vcode}`, loginVo)
}

export const logout = () => {
  return request.post('/employees/logout')
}
